<?php
/*
 * string cyrillic_to_roman($string)
 *
 * Converts cyrillic text to the roman alphabet
 * 
 */

function cyrillic_to_roman($string) {
	$translations = array(
		'А' => 'a',  'Б' => 'b',  'В' => 'v',  'Г' => 'g',
		'Д' => 'd',  'Е' => 'e',  'Ё' => 'ë',  'Ж' => 'ž',
		'З' => 'z',  'И' => 'i',  'Й' => 'j',  'К' => 'k',
		'Л' => 'l',  'М' => 'm',  'Н' => 'n',  'О' => 'o',
		'П' => 'p',  'Р' => 'r',  'С' => 's',  'Т' => 't',
		'У' => 'u',  'Ф' => 'f',  'Х' => 'x',  'Ц' => 'c',
		'Ч' => 'č',  'Ш' => 'š',  'Щ' => 'šč', 'Ъ' => 'ʺ',
		'Ы' => 'y',  'Ь' => 'ʹ',  'Э' => 'è',  'Ю' => 'ju',
		'Я' => 'ja', 'І' => 'i',  'Ѳ' => 'f',  'Ѣ' => 'ě',
		'Ѵ' => 'i',  'Ѕ' => 'dz', 'Ѯ' => 'ks', 'Ѱ' => 'ps',
		'а' => 'a',  'б' => 'b',  'в' => 'v',  'г' => 'g',
		'д' => 'd',  'е' => 'e',  'ё' => 'ë',  'ж' => 'ž',
		'з' => 'z',  'и' => 'i',  'й' => 'j',  'к' => 'k',
		'л' => 'l',  'м' => 'm',  'н' => 'n',  'о' => 'o',
		'п' => 'p',  'р' => 'r',  'с' => 's',  'т' => 't',
		'у' => 'u',  'ф' => 'f',  'х' => 'x',  'ц' => 'c',
		'ч' => 'č',  'ш' => 'š',  'щ' => 'šč', 'ъ' => 'ʺ',
		'ы' => 'y',  'ь' => 'ʹ',  'э' => 'è',  'ю' => 'ju',
		'я' => 'ja', 'і' => 'i',  'ѳ' => 'f',  'ѣ' => 'ě',
		'ѵ' => 'i',  'ѕ' => 'dz', 'ѯ' => 'ks', 'ѱ' => 'ps',
		'Ѡ' => 'ô',  'ѡ' => 'o',  'Ѫ' => 'ǫ',  'ѫ' => 'u',
		'Ѧ' => 'ę',  'ѧ' => 'ja', 'Ѭ' => 'jǫ', 'ѭ' => 'ju',
		'Ѩ' => 'ję', 'ѩ' => 'ja'
	);
	foreach($translations as $k => $v) {
		$string = str_replace($k, $v, $string);
	}
	return $string;
}